///
/// @file CharType.h
/// @brief 字符类型
/// @author GitHub Copilot
/// @version 1.0
/// @date 2024-12-19
///
/// @copyright Copyright (c) 2024
///
/// @par 修改日志:
/// <table>
/// <tr><th>Date       <th>Version <th>Author  <th>Description
/// <tr><td>2024-12-19 <td>1.0     <td>GitHub Copilot  <td>新建
/// </table>
///
#pragma once

#include "Type.h"

///
/// @brief 字符类型
///
class CharType : public Type {

private:
    /// @brief 私有构造函数
    CharType();

    /// @brief 静态实例，确保全局唯一
    static CharType * instance;

public:
    /// @brief 析构函数
    ~CharType() = default;

    /// @brief 禁用拷贝构造函数
    CharType(const CharType &) = delete;

    /// @brief 禁用赋值运算符
    CharType & operator=(const CharType &) = delete;

    /// @brief 获取字符类型实例
    /// @return 字符类型实例指针
    static CharType * getType();

    /// @brief 判断是否为字符类型
    /// @return true 是字符类型，false 不是字符类型
    bool isCharType() const override
    {
        return true;
    }

    /// @brief 类型的字符串描述
    /// @return 类型字符串
    std::string toString() const override;

    /// @brief 类型是否相同
    /// @param other 待比较的类型
    /// @return true 类型相同，false 类型不同
    bool equals(const Type * other) const override;

    /// @brief 获取类型字节数
    /// @return 类型字节数
    int32_t getSize() const override;
};
